// 这里没有解决跨域问题，但可以通过后解决跨域问题在后端的Controller层使用@CrossOrigin
import request from '../utils/request'

export function getExportList(currentPage, pageSize) {
  return request({
    url: '/export',
    method: 'get',
    params: {
      currentPage,
      pageSize
    }
  })
}

export function findExportList(flag, value, currentPage, pageSize) {
  return request({
    url: '/export/find',
    method: 'get',
    params: {
      flag,
      value,
      currentPage,
      pageSize
    }
  })
}

export function addExport(exportData,exportGoodsList) {
  return request({
    url: '/export',
    method: 'post',
    data: {
      address:exportData.address,
      discPrice:exportData.discPrice,
      name:exportData.name,
      price:exportData.price,
      sex:exportData.sex,
      status:exportData.status,
      tel:exportData.tel,
      time:exportData.time,
      exportGoodsList: JSON.stringify(exportGoodsList)
    }
  })
}


export function deleteExport(exportId) {
  return request({
    url: '/export',
    method: 'delete',
    params: {
      exportId: exportId
    }
  })
}

export function editExport(data) {
  return request({
    url: '/export',
    method: 'put',
    params: {
      ...data
    }
  })
}

export function  exportExcel(){
  return request({
    url: '/export/export',
    method: 'get',
    responseType: 'blob'
  })
}

